package com.example.demo.demos.web;

import com.deepoove.poi.XWPFTemplate;
import com.deepoove.poi.data.HyperlinkTextRenderData;
import com.deepoove.poi.data.Pictures;

import java.io.IOException;
import java.util.HashMap;

public class ConfigureTest {

    public static void main(String[] args) throws IOException {
        XWPFTemplate.compile("D:\\poi-tl-master\\poi-tl\\src\\test\\resources\\template\\config_chinese.docx").render(new HashMap<String, Object>() {
            {
                put("作者姓名", "Sayi");
                put("作者别名", "卅一");
                put("头像", Pictures.ofLocal("D:\\word\\3.png").create());
                put("详情网址", new HyperlinkTextRenderData("http://www.deepoove.com", "http://www.deepoove.com"));
                put("详情", new HashMap<String, Object>() {
                    {
                        put("描述", new HashMap<String, String>() {
                            {
                                put("日期", "2019-05-24");
                            }
                        });
                    }
                });
            }
        }) .writeToFile("target/out_templateo122.docx");;
    }

}
